package com.leisurexi.ioc.factory.bean;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @author: leisurexi
 * @date: 2020-06-26 0:05
 * @since JDK 1.8
 */
public class FactoryBeanDemo {

	public static void main(String[] args) {
		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
		XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
		reader.loadBeanDefinitions("META-INF/factory-bean.xml");
		Car car = (Car) beanFactory.getBean("car");
		System.out.println(car);
		CarFactoryBean carFactoryBean = (CarFactoryBean) beanFactory.getBean("&car");
		System.out.println(carFactoryBean);
	}

}
